<?php if (hasPermission("namespaces.object.create.discussioncomment")): ?>
	<?php $this->append ("scripts", "forumtag"); ?>
	
	<form action="<?php echo Gene::makeLink($object) ?>/new/discussioncomment" method="post" id="addcomment">
	
	<fieldset>
	<legend>Add Comment</legend>
	
	<?php if ($draft): ?>
		<input type="hidden" name="draftid" value="<?php echo $draft['draft_id'] ?>" />
	<?php endif; ?>
	
	<?php if (!$loggedin): ?>
		<?php $this->display ("objects/guest") ?>
	<?php endif; ?>
	
	<p class="fieldlabel"><label for="formobjcontent">Message:</label></p>
	<p class="field">
	<?php if ($quote):
		$quotetext = '<blockquote><p><strong>'.$quote['name'].' said:</strong></p>'.$quote['content'].'</blockquote>' ?>
		<?php $this->display('objects/enhancedinput', array('rows' => 12, 'required' => true, 'edit' => array('content' => $quotetext))) ?>
	<?php else: ?>
		<?php $this->display('objects/enhancedinput', array('rows' => 12, 'required' => true)) ?>
	<?php endif; ?>
	</p>
	
	<?php if (count($usertags)): ?>
		<p id="edittags"><a href="#" onclick="javascript:editTags();return false;">Edit Discussion Tags (<span id="edittaglist"><?php echo implode(" ", $usertags) ?></span>)</a></p>
		<div id="tageditor" class="prefilled">
	<?php else: ?>
		<div id="tageditor">
	<?php endif; ?>
	
	<p class="fieldlabel"><label for="tags">Discussion Tags:</label></p>
	<p class="field"><input type="text" id="tags" name="tags" autocomplete="off" size="48"
	<?php if (isset($options['tags'])): ?>
		value="<?php echo implode(' ', $options['tags']) ?>"
	<?php elseif (count($usertags)): ?>
		value="<?php echo implode(" ", $usertags) ?>"
	<?php endif; ?> /></p>
	<p class="field" id="tagssuggest">Separate tags with spaces.</p>
	
	<?php if (count($tags)): ?>
		<p class="fieldlabel">Popular Tags:</p>
		<p id="globalsuggest" class="field"><?php foreach ($tags as $i): ?>
			<a href="#" onclick="javascript:return toggleTag('<?php _e($i) ?>');" class="suggest tagname"><?php _e($i) ?></a> 
		<?php endforeach; ?></p>
	<?php endif; ?>
	
	<?php if (count($userforumtags)): ?>
		<p class="fieldlabel">My Tags:</p>
		<p id="usersuggest" class="field"><?php $this->display('objects/discussion/addtags', array('terms' => $userforumtags, 'type' => 'user')) ?></p>
	<?php endif; ?>
	
	</div>
	
	<p class="formcontrols">
	<input type="submit" value="Add Comment" class="btn_focus" />
	
	<?php if ($draft || getUserProperty('drafts') < Gene::getSetting('maximum_drafts')): ?>
		<input type="submit" name="draft" value="Save Draft" class="btn_minor skipcheck" />
	<?php endif; ?>
	</p>
	
	</fieldset>
	
	</form>
<?php endif; ?>